1. Field of the Invention
The present invention relates to optical data storage, and more specifically, to a method of defect management while accessing data on optical disks.
2. Description of the Prior Art
For their relatively low price, small volume, and light weight, optical disks can store huge amounts of information. Optical disks are now one of the most frequently used data storage media. Writable optical disks allow users to conveniently write personal data making optical disks one of the most important portable personal storage media. How to make data access in writable optical disks more reliable and more efficient is becoming a focal point of research in modern information industry.
An optical disk drive is needed to access data on the optical disk. Please refer to FIG. 1. FIG. 1 is a functional block diagram of a prior art optical disk drive 10 that is used to access an optical disk 22. The optical disk drive 10 further comprises a disk loader 14, a motor 12 that drives the disk loader 14 to spin, a pickup head 16 to access data on the optical disk 22, a control circuit 18 that controls the operation of optical disk drive 10 and a memory 20 (such as a volatile random-access memory) to temporarily hold data needed for control circuit 18 during operation. The optical disk 22 includes track 24 to record data. After the optical disk 22 is put onto the disk loader 14, the motor 12 drives the optical disk 22 to spin. The track 24 on the optical disk 22 spins as the optical disk 22 rotates and sweeps across the pickup head 16, such that the control circuit 18 can access the data on the track 24 via the pickup head 16. The control circuit 18 is controlled by a host 26, such as a computer system, to access the data on the optical disk 22.
To make the function of optical disk data recording more reliable, there are certain defect management mechanisms in the more advanced optical disk specifications. One of the most common is to allocate certain sections as spare record areas. When there are defects on the optical disk that makes recording impossible, the data can be recorded on the spare record area so the data recording function of optical disk is not affected by such defects. Please refer to FIG. 2A and FIG. 2B. FIG. 2A and FIG. 2B are schematic diagrams of spare record area and normal record area allocation in two different kinds of optical disk specification. FIG. 2A is the allocation under the Compact Disk-Mount Rainier reWritable (CD-MRW) specification, and FIG. 2B is for Digital Versatile Disk (DVD).
As shown in FIG. 2A, track 24 is used for data recording and is divided into several major sectors, namely, a Lead-In Area (LI), a Program Area (PA), and a Lead-Out Area (LO). The Lead-In Area (LI) and Lead-Out Area (LO) are used for marking the beginning and end of the track 24 respectively; and the Program Area (PA) is used to record data. One region of the Lead-In Area (LI) is separated to act as a Main Table Area (MTA), a Defect Table (DT) being stored in this region. The PA is further divided into a pre-gap (P0), a General Application Area (GAA), Secondary Table Area (STA) to store a backup copy of a defect record table, and a plurality of Spare Areas (SA). In FIG. 2A, different data areas (DA) are marked from SA(1), SA(2), to SA(N). All Data Areas (DA) are further divided into a predetermined number of Packets (Pd), each Packet (or so-called Data Packet Area) Pd having a plurality of user data blocks (Bd), and each Data Blocks Bd being used to record one data entry. Similarly, each spare area SA(n) is further divided into a predetermined number of Packets (Ps), each Packet (or so-called Spare Packet) having a plurality of spare data blocks (Bs). Data blocks (Bd) and spare blocks (Bs) are all writable data blocks with equivalent data storage capacity. For instance, in the CD-MRW specification, one Data Area (DA) has 136 packets (Pd), and every packet (Pd) has 32 user data blocks (Bd); and one Spare Area (SA) has 8 packets (Ps), and every packet (Ps) has 32 spare blocks (Bs). Every user data block (Bd) and spare block Bs is used to record 2 kilobytes of data. As shown in FIG. 2A, track 24 spins as the optical disk rotates over the pickup head 16. Relatively speaking, the pickup head 16 will sequentially pass through every block on the track 24 (including data blocks and spare blocks). For instance, when the pickup head 16 follows the arrow A1 in FIG. 2A and sweeps across track 24, it will first pass all the spare blocks on Spare Area SA(1), and then pass all data blocks on Data area DA(1) sequentially, and then pass another Spare Area SA(2), and so on.
According to similar principals of allocation, in the specification of DVD+MRW in FIG. 2B, track 24 also has a Lead-In Area (LI2) to mark the beginning of the track, a data zone (DZ) to record data, and a Lead-Out Area (LO2) to mark the end of the track. The Lead-In Area (LI2) has a Main Table Area (MTA2) to store a Defect Table. The Data area (DZ) is further divided into a General Application Area (GAA2), a Secondary Table Area (STA2) that is used to store the backup of the Defect Table, a User Data Area (UDA), and two Spare Areas (SA1) and (SA2). Similarly, the User Data Area (UDA) has a plurality of data blocks (BdO) (e.g. 139218 ECC blocks). Spare Areas (SA1), (SA2) also have a plurality of spare blocks (BsO) (e.g. 256 and 3840 ECC blocks respectively).
The basic principals of defect management are the same, no matter which data format is used (FIG. 2A or FIG. 2B) for the optical disk 22. Whenever the optical disk drive 10 is required to write data from the host 26 (refer to FIG. 1) to the optical disk 22, it will first write the data into a data block of the track 24. If a defect is encountered and it is impossible to record data into the data block correctly, the optical disk drive will find a substitute spare block and write data that was meant to be in the defect data block into this substitute spare block. In practical operation, each spare block and data block has its own address (such as a PBN, Physical Block Number). For a defect data block and a corresponding spare block to substitute for this defect data block, both addresses and their correlation are recorded in the defect table on the optical disk 22. When the optical disk drive 10 is required to read data from this optical disk, once it reaches the defect data block, it will first determine the corresponding substitute spare block via the record in defect table, and then read the data in this substitute spare block. According to the operational principle described above, even with some defects on the optical disk (probably caused by scratches or dust), by setting up and using spare blocks to implement defect management via a defect table, one can still maintain the data recording function of the optical disk 22.
Please refer to FIG. 3. FIG. 3 is a flowchart of a data write process 100 for a prior art optical disk. In order to perform the defect management described above when writing data onto an optical disk, the prior art process 100 uses these steps:
Step 102: Begin the data write process 100;
Step 104: The optical disk drive 10 receives a write instruction from the host 26 to write data transferred from the host 26 onto the optical disk 22. The host 26 will specify which data block on the optical disk 22 to write to;
Step 106: Receive data transferred from the host 26, temporarily store it in the memory 20, and start to record the data in the memory 20 onto the track 24 of the optical disk 22;
Step 108: If defect data blocks are encountered during the write process in step 106, further write work should be suspended, go to step 110 to perform defect management; if no defect data blocks are encountered, continue to step 112. The optical disk drive 10 can reference the Defect Table to see if defect data blocks are encountered;
Step 110: Perform defect management, writing data into substitute spare blocks.
In step 108, when one defect data block is encountered, the optical disk drive 10 can reference the Defect Table to find out the address of the spare block corresponding to this defect data block. The optical disk drive 10 can control the pickup head 16 and reference the address to move to corresponding position of the spare block, and write data into this spare block;
Step 112: If all the data transferred from the host 26 is written onto the optical disk 22, proceed to step 114; if not, go back to step 106;
Step 114: End of the prior art optical disk data write process 100.
For further information on the prior art process 100 as described above, please refer to FIG. 4A through FIG. 4E. FIG. 4A to FIG. 4E are schematic diagrams of the prior art process 100 in action, specifically, the related data allocation of the optical disk 22 and the memory 20 of the optical disk drive 10. If the host 26 requires the optical disk drive 10 to start writing data into data packet Pd1 (having data blocks Bd1a, Bd1b, Bd1c . . . ), packet Pd2 (having data blocks Bd2a, Bd2b, Bd2c . . . ), packet Pd3, etc, process 100 commences. In FIG. 4A, the host 26 starts to transfer data (to be written to the optical disk 22) to the optical disk drive 10, and the optical disk drive 10 temporarily stores this data in the memory 20. The optical disk drive 10 allocates a memory space 28 with a section of fixed memory capacity. The memory space 28 has a plurality of memory units 28u, each memory unit 28u being used to temporarily store one entry of data that is going to be written to the data block (for simplified explanation, two memory units are marked 28u1 and 28u2 respectively). When the host 26 issues a write instruction to optical disk drive 10 (step 104), the host 26 sequentially transfers data to be written to the optical disk 22 to memory 20 (step 106), and the memory 20 also temporarily stores the data in one memory unit 28u. A transfer pointer (TA) in FIG. 4A to FIG. 4E is used to mark the progress of the data transfer of the host 26. Referring to FIG. 4A, when the host 26 is required to transfer data in the corresponding data block Bd1a to the memory 20, the transfer pointer Ta points to the memory unit 28u1, and temporarily stores this data in the memory unit 28u1. Next, the transfer pointer Ta points to the memory unit 28u2 sequentially, and the host 26 transfers the data, which is supposed to be written to the data block Bd1b, to memory 20, and then references the instruction of the transfer pointer Ta to temporarily store the data in the memory unit 28u2. When the host 26 transfers data that is supposed to be written to data blocks Bd1a, Bd1b, Bd1c to the memory 20 sequentially, the transfer pointer Ta shifts accordingly, pointing to different memory units and reaching the position shown in FIG. 4A. Based on a similar principle, the optical disk drive 10 follows a Write Pointer Tb to write data in every memory unit of the memory 20 into data blocks of the optical disk drive 22. In FIG. 4A, it is supposed that the host has not started writing data into tracks 24 of optical disk 22, so the write pointer Tb still points to the memory unit 28u1.
Referring to FIG. 4B, the pickup head 16 starts to write data into the corresponding data blocks of the track 24. As data in the memory units is sequentially written into the track 24, the write pointer Tb points to the next memory unit that stores data. As data is written into the data blocks Bd1a, Bd1b, Bd1c the write pointer Tb points to the different memory units 28u1, 28u2, etc accordingly. Data that has been written into the corresponding data blocks can now be released by the memory 20, so the memory space that stores this data can be recycled. As shown in FIG. 4B, data temporarily stored in the memory units 28u1 and 28u2 will be released after it is written into the data blocks Bd1a and Bd1b, so the data in the memory units can be overwritten afterwards. In the meantime, the host 26 continues to transfer data that is supposed to be written into the data blocks Bd2a, Bd2b, to Bd1c into the memory space 28, and the position that transfer pointer Ta points to changes accordingly. When data is written into data blocks Bd1a, Bd1b, to Bd1c, if there are no defects in the data blocks of the optical disk 22 and data can be recorded correctly, and the process 100 can continue smoothly.
Referring to FIG. 4C, with the progression of the write process, originally started in FIG. 4B where the write pointer points to a memory unit that temporarily stores data for the data block Bd1c, the write pointer has advanced to the memory unit that temporarily stores data for the data block Bd2b. In the meantime, the host 26 keeps on transferring data that is supposed to be written onto the optical disk 22 to the memory 20, and this also advances the transfer pointer Ta to point to a different memory unit (such as the memory unit that temporarily stores data that is supposed to be written to data block Bd3b). Suppose, on the track 24, the data block Bd2b is a defect data block, and the spare block substituted for this defect data block Bd2b to record data belongs to the spare block Bs1b of spare packet Ps1. After encountering the defect data block Bd2b, the prior art process 100 suspends the writing process. As shown in FIG. 4D, after encountering the defect data block Bd2b, the prior art process 100 proceeds from step 108 to step 110, and lets the pickup head 16 seek the position of the corresponding spare block Bs1b, and write the data that is supposed to be written into the defect data block Bd2b into the spare block Bs1b. In practice, the optical disk drive 10 will first read every spare block of the spare packet Ps1 into memory 20 and add the data of data block Bd2b into this spare packet Ps1, then write all the spare blocks of this spare packet Ps1 to the track 24. In FIG. 4E, the pickup head 16 seeks and returns to where it was interrupted, and continues to step 106 to write the remaining data into data block of the track 24 (e.g. write data to data block Bd3a, etc).
As shown in the optical disk specification in FIG. 2A or FIG. 2B, areas of accumulated spare block allocation (e.g. Spare areas SA or SA1, SA2) and areas of accumulated data block allocation (e.g. data areas or user data areas UDA) are interlaced with each other on track 24, so if the pickup head 16 shifts from an original position that corresponds to data blocks to a position corresponding to spare blocks, it will have to travel a relatively long distance taking much time. From the process described above, we know that during optical disk data write, the prior art process 100 uses the pickup head 16 to seek and cross over multiple packets in order to perform necessary spare block data writing (only in this way can defect management for defect data blocks be implemented), and afterwards seeking back to where it was interrupted and continuing further data writing into data blocks. Supposing that a plurality of defect data blocks were encountered during continuous data write, the prior art process 100 described above will be busy seeking in order to perform individual defect management for each defect data block. This will lower the efficiency of the optical disk data write of the prior art process 100, and increase the operational burden for actuating mechanisms of the pickup head 16, causing it to wear out easily.
Corresponding to the optical disk data writing process 100, there is also a process for optical disk data reading in the prior art. Please refer to FIG. 5. FIG. 5 is a flowchart of a process 200 used to perform defect management during optical disk data reading. The following steps are in the process 200:
Step 202: Start. When the host 26 requests the optical disk drive 10 to start to data read, the process 200 begins. The host 26 notifies the optical disk drive 10 regarding which data in the data blocks needs to be read;
Step 204: The optical disk drive 10 reads data from the optical disk 22. Data that is supposed to be read into the optical disk drive is first stored in the memory 20 temporarily;
Step 206: If defect data blocks are encountered during the read process, go to step 208; otherwise continue to step 210. Based on the Defect Table of the optical disk, the optical disk drive can judge if the data blocks encountered during the read process are defect data blocks or not;
Step 208: Perform defect management. In step 206, if it is time to read the defect data block, based on the Defect Table, the optical disk drive can locate the address of the spare block used to substitute this defect data block, and according to this address, the pickup head 16 will seek the corresponding location of the spare block, and read the data recorded in this spare block for defect management;
Step 210: Transfer the data temporarily stored in the memory to the host 26 to meet the read request of the host 26. If the process 200 comes to this step via step 206, 208, it means that defect data blocks were encountered during the read process, and the optical disk drive is not able read the data recorded in these defect data blocks. However, since in step 210, defect management has been performed and the correct data in this defect data block was read from a corresponding spare block, the correct data can be transferred to the host 26;
Step 212: If data transfer is complete, continue to step 214; if not yet finished transferring all the data requested by the host 26 to the host 26, go back to step 204;
Step 214:End.
For more information on the prior art process 200 described above, please refer to FIG. 6A through FIG. 6D. FIG. 6A to FIG. 6D show the related data allocation on track 24 and the memory 20 in different time frames when the process 200 reads data from the optical disk. Referring to FIG. 4A through FIG. 4E, if the host 24 requests the optical disk drive 10 to read the data in packets Pd1 to Pd3, the process 200 begins. Similar to the data write process of the optical disk described above, when reading data on the optical disk, data read by optical disk drive 10 is temporarily stored in a memory space 29 having a fixed memory capacity. The memory space 29 has a plurality of memory units 29u (for convenience marked 29u1 and 29u2), each used to temporarily store one data entry from the memory block. Similarly, the read pointer Td in FIG. 6A to FIG. 6D points to a memory unit used to temporarily store the data read by the pickup head 16. The memory units having data to transfer to the host 26 are pointed to by transfer pointer Tc. As shown in FIG. 6A, as the pickup head 16 starts to sequentially read data blocks such as Bd1a, Bd1b, etc on track 24, the read pointer Td sequentially points to the memory units 29u1, 29u2 and temporarily stores the data read from blocks Bd1a, Bd1b by pickup head 16 into memory units 29u1, 29u2. When the pickup head 16 reads the data in the data block Bd1c, the memory unit that the read pointer Td points to is as shown in FIG. 6A. In FIG. 6A, the data read from the track 24 in the memory space 29 has not yet been transferred to the host 26, so the transfer pointer Tc still points to the memory unit 29u1.
As shown in FIG. 6B, as the process 200 progresses, the pickup head 16 keeps reading data from the track 24, the read pointer Td advances accordingly and sequentially points to different memory units, and the data read by pickup head 16 is stored in the memory space 29 temporarily. Meanwhile, the optical disk drive 10 starts to transfer data in the memory space 29 to the host 26, so the host 26 can receive the data it requested. As the transfer pointer Tc points to the memory units 29u1, 29u2, data read from data blocks Bd1a, Bd1b and stored temporarily in the memory units 29u1, 29u2 (please also refer to FIG. 6A) will also be transferred to the host 26. After the optical disk drive 10 has finished transferring data from the data block Bd1d in the memory space 29 to the host 26, the memory unit that transfer pointer Tc points to is as shown in FIG. 6B. The memory unit with content transferred to the host 26 can be released, so new data can be written to this memory unit. For instance, memory units 29u1, 29u2 in FIG. 6B are released for other data because their temporary content has been transferred to the host 26. As the read pointer Td and the transfer pointer Tc advance, the process 200 performs step 204 and step 210 continuously. In FIG. 6C, the process 200 has encountered defect data block Bd2b. If the spare block to substitute for the defect data block Bd2b is spare block Bs1b in the spare packet Ps1, the optical disk drive 10 suspends further data reading, and moves pickup head 16 across track 24 to the position corresponding to spare block Bs1b, and begins step 208, reading in the data in block Bs1b and adding it to memory space 29. As shown in FIG. 6D and step 208, after the data in spare block Bs1b is read, the pickup head 16 moves across the track 24 and returns to where it was interrupted and continues further data access. The read pointer Td and the transfer pointer Tc also continue to advance, reading data on the track 24 to the memory space 29, and transferring the data in the memory space 29 back to the host 26.
From the above description of the data read process for the prior art optical disk, we know that in the prior art, every defect data block encountered suspends the continuous reading process. This is to allow the pickup head 16 to move across the track 24 and read the corresponding spare block for the defect data block to implement defect management for the defect data block. Subsequently, the pickup head 16 has to seek and return to where it was interrupted and continue further data reading. If there are numerous of defect data blocks on the optical disk, the prior art described above must frequently interrupt the reading process and perform defect management for every individual defect data block. In this way, efficiency of data access for the optical disk is sacrificed. Furthermore, when combining the processes 100, 200 for the prior art optical disk to read and write data, defect management is based on individual defect data blocks. This not only hampers the efficiency of the processes of data reading and writing, but also increases the mechanical wear to the optical disk drive through unnecessary pickup head mechanical movement.